package demo08.Adapter.duck;

public class TurkeyTestDrive {
	public static void main(String[] args) {
		MallardDuck duck = new MallardDuck();//绿头鸭
		Turkey duckAdapter = new DuckAdapter(duck);//适配器包装鸭子成火鸡
 
		for(int i=0;i<5;i++) {
			System.out.println("The DuckAdapter says...");
			duckAdapter.gobble();//鸭子对象调用火鸡的方法
			duckAdapter.fly();
		/*	The DuckAdapter says...
			绿头鸭呱呱叫
			The DuckAdapter says...
			绿头鸭呱呱叫
			The DuckAdapter says...
			绿头鸭呱呱叫
			The DuckAdapter says...
			绿头鸭呱呱叫
			The DuckAdapter says...
			绿头鸭呱呱叫*/
		}
	}
}
